<script type="text/javascript" src="/js/box_edit.js"></script>
<ol class="breadcrumb">
    <li><a href="#">奇妙云箱</a></li>
    <li><a href="/box/list">箱子管理</a></li>
    <li>编辑箱子</li>
</ol>
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="glyphicon glyphicon-pencil"></span>
        <span class="panel-title">请填写箱子信息</span>
    </div>
    <div class="panel-body">
        <form onsubmit="return check()" action="/box/edit" method="post" name="form1"
              class="form-horizontal">
            <input type="hidden" name="boxid" value="<%= boxid %>"/>
            <input type="hidden" name="osim" value="<%= sim %>"/>
            <input type="hidden" name="ocode_layout" value="<%= boxdatas[0].code_layout %>"/>
            <input type="hidden" name="odoors_num" value="<%= boxdatas[0].doors_num %>"/>
            <input type="hidden" name="obox_layout" value="<%= boxdatas[0].box_layout %>"/>

            <div class="alert alert-warning" role="alert"><span class="text-red">*</span>项为必填项</div>
            <div class="form-group">
                <label class="col-xs-2 control-label"><span class="text-red">*</span>Sim卡号：</label>

                <div class="col-xs-9">
                    <select class="form-control" name="sim" id="sim">
                        <% if(!sim){ %>
                        <option value="0">请选择Sim卡号</option>
                        <% } %>
                        <% for(var i = 0;i < simdatas.length;i++){ %>
                        <option value="<%= simdatas[i].sim %>" <%= sim==simdatas[i].sim?'selected="selected"':'' %>><%= simdatas[i].sim %></option>
                        <% } %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label">授权用户：</label>

                <div class="col-xs-9">
                    <select class="form-control" name="buyer" id="buyer">
                        <% if(!boxdatas[0].owner){ %>
                        <option value="0">请选择用户名</option>
                        <% } %>
                        <% for(var i = 0;i < buyerdatas.length;i++){ %>
                        <option value="<%= buyerdatas[i]._id %>" <%= boxdatas[0].owner==buyerdatas[i]._id?'selected="selected"':'' %>><%= buyerdatas[i].user %></option>
                        <% } %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label">箱子贴条位置：</label>

                <div class="col-xs-9">
                    <select class="form-control" name="code_layout" id="country">
                        <option value="0"><%= boxdatas[0].code_layout %></option>
                        <% if(boxdatas[0].code_layout == '左上角'){ %>
                        <option value="右上角">右上角</option>
                        <% }else{ %>
                        <option value="左上角">左上角</option>
                        <% } %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label"><span class="text-red">*</span>格子数量：</label>

                <div class="col-xs-9">
                    <select class="form-control" name="doorNum" onChange="getNum()" id="first">
                        <option value="0"><%= boxdatas[0].doors_num %></option>
                        <option value="2">2</option>
                        <option value="4">4</option>
                        <option value="6">6</option>
                        <option value="8">8</option>
                        <option value="10">10</option>
                        <option value="12">12</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label"><span class="text-red">*</span>箱子布局：</label>

                <div class="col-xs-9">
                    <select class="form-control" id="secend" name="boxlayout">
                        <option value="<%= boxdatas[0].box_layout %>"><%= boxdatas[0].box_layout %></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-xs-9 col-xs-offset-2">
                    <input class="btn btn-success col-xs-2" type="submit"
                           value="提交" id="sub_btn">
                </div>
            </div>
        </form>
    </div>
</div>